/*
 * GunCMS Version 1.0.3
 * Copyright(c) 2009-2010, T & L GdbR
 * info@guncms.de
 * 
 * http://www.guncms.de
 */
function onDeletePhotos(url, photoID,ajaxResponse) {
	var isOK = -1;
	
	if(!confirm('Are you sure you want to delete the photo with Id:' + photoID)) {
		return false;
	}
	
	new Ajax.Request(url, {
	  method: 'post',
	  asynchronous: false,
	  parameters:'act=delphoto&id=' + photoID,
	  onSuccess: function(transport) {
			var response = transport.responseText || "";
			var pos=response.indexOf('<!');
			content=response.substring(1,pos);
			
			obj = content.evalJSON();

    		if(obj == null) {
    			$(ajaxResponse).innerHTML = 'Something wrong! Reponsed string is: ' + response;
    		}
    		
    		isOK = obj.code;
		
    		$(ajaxResponse).update(obj.message);
		}
	});

	$(ajaxResponse).style.display = 'inherit';
	Fat.fade_element(ajaxResponse, null, 1500, null, null);

	if(isOK == 0) {
		
		//$(cbo + '-' + catId).remove();
		
		rowID = 'row-' + photoID;
		Fat.fade_element(rowID, null, 1000, "#f22", null);
		setTimeout("$(rowID).remove()", 1000);
		
	}				
}


function onDeleteGallery(url, galleryID,ajaxResponse,txt) {
	var isOK = -1;
	
	if(!confirm('Are you sure you want to delete the '+txt+' with Id:' + galleryID)) {
		return false;
	}
	
	new Ajax.Request(url, {
	  method: 'post',
	  asynchronous: false,
	  parameters:'act=delgallery&id=' + galleryID,
	  onSuccess: function(transport) {
			var response = transport.responseText || "";
			var pos=response.indexOf('<!');
			content=response.substring(1,pos);
			
			obj = content.evalJSON();

    		if(obj == null) {
    			$(ajaxResponse).innerHTML = 'Something wrong! Reponsed string is: ' + response;
    		}
    		
    		isOK = obj.code;
		
    		$(ajaxResponse).update(obj.message);
		}
	});

	$(ajaxResponse).style.display = 'inherit';
	Fat.fade_element(ajaxResponse, null, 1500, null, null);

	if(isOK == 0) {
		
		rowID = 'row-' + galleryID;
		Fat.fade_element(rowID, null, 1000, "#f22", null);
		setTimeout("$(rowID).remove()", 1000);
		
	}				
}